//
//  LevelManager.h
//  Project
//
//  Created by Nguyen Tan Loc on 8/10/13.
//  Copyright (c) 2013 Nguyen Tan Loc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "GDataXMLNode.h"
#import "Bomb.h"
#import "Path.h"
#import "Lazer.h"
#import "Energy.h"
#import "BouncingBall.h"
#import "Boundary.h"
#import "Item.h"
#import "DarkFog.h"
#import "Cactus.h"
#import "FallingStar.h"
#import "DangerZone.h"
#import "BombIndicator.h"


// define for level require (star)
typedef enum
{
    eLRT_FINISH_PATH = 0,
    eLRT_RUSH_TIME,
    eLRT_ENERGIZE,
} eLevelRequireType;

@interface LevelRequire : NSObject
{
    eLevelRequireType   mType;
    int               mValue;
}

@property (nonatomic, assign) eLevelRequireType _type;
@property (nonatomic, assign) int             _value;

@end


//
@interface LevelDetail : NSObject <NSCoding>
{
    int     mScore;
    int     mStar;
    int     mEnergy;
    float   mTime;
}

@property (nonatomic, assign) int   _score;
@property (nonatomic, assign) int   _star;
@property (nonatomic, assign) int   _energy;
@property (nonatomic, assign) float _time;

@end


// ------- LevelManager ----------
@interface LevelManager : NSObject
{
    int     mNumEnergy;
    int     mMaxNumEnergy;
    int     mCurrentLevel;
    int     mMaxReachLevel;
    BOOL    mIsDarkFog;
    BOOL    mIsNewLevel;
    BOOL    mIsStartNow;
    
    float   mLevelTime;
    float   mItemMagnetTime;
    float   mItemShieldTime;
    
    NSString *mItemAvailable;
    
    NSArray *mListLevel;
    NSMutableArray *mListLevelDetail;
    NSMutableArray *mListLevelRequire;
    GDataXMLDocument *mDataXMLDocument;
}

@property (nonatomic, assign) int       _numEnergy;
@property (nonatomic, assign) int       _maxNumEnergy;
@property (nonatomic, assign) int       _currentLevel;
@property (nonatomic, assign) float     _levelTime;
@property (nonatomic, assign) float     _itemMagnetTime;
@property (nonatomic, assign) float     _itemShieldTime;
@property (nonatomic, readonly) BOOL    _isDarkFog;
@property (nonatomic, assign) BOOL      _isNewLevel;
@property (nonatomic, assign) BOOL    _isStartNow;
@property (nonatomic, readonly) float   _nodeSpreadSpeed;
@property (nonatomic, readonly) float   _lineSpreadSpeed;
@property (nonatomic, readonly) int     _maxReachLevel;

+(LevelManager *) getInstance;
-(NSString *) getLevelName:(int)level;
-(NSString *) getCurrentLevelName;
-(LevelDetail *) getLevelDetail:(int)level;
-(LevelDetail *) getCurrentLevelDetail;
-(void) loadCurrentLevel;
-(void) loadLevel:(NSString *)path;
-(void) removeData;

-(BOOL) isItemAvailable:(ITEM_TYPE)type;
-(BOOL) isAvailableNextLevel;
-(int) getNumItemAvailable;
-(int) getNumLevel;
-(int) getNumStar;
-(int) getNumMaxStar;
-(void) unlockNewLevel;
-(ccColor3B) getWorldColor;
-(ccColor3B) getWorldColorWithLevel:(int)level;

//
-(NSArray *) getListBomb;
-(NSArray *) getListPath;
-(NSArray *) getListLazer;
-(NSArray *) getListEnergy;
-(NSArray *) getListBouncBall;
-(NSArray *) getListItem;
-(NSArray *) getListDecor;
-(NSArray *) getListTutorial;
-(NSArray *) getListLevelRequire;

@end
